package com.liarjo.mywebsiteapi.admin.controller.messageBoard;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liarjo.mywebsiteapi.admin.controller.messageBoard.page.MessageBoardPageRequest;
import com.liarjo.mywebsiteapi.admin.controller.messageBoard.page.MessageBoardPageResult;


@Service
public class MessageBoardService {
    @Autowired
    private MessageBoardMapper messageBoardMapper;

    public IPage<MessageBoardPageResult> page(MessageBoardPageRequest messageBoardPageRequest) {
        IPage<MessageBoardPageResult> page = new Page<>(messageBoardPageRequest.getCurrent(),messageBoardPageRequest.getSize());
        IPage<MessageBoardPageResult> pageResult = messageBoardMapper.page(messageBoardPageRequest, page);
        return pageResult;
    }
}
